<template>
  <div v-if="Object.keys(goods).length !== 0" class="base-info">
    <div class="infotitle">{{ goods.title }}</div>
    <div class="infoprice">
      <span class="newprice">{{ goods.newPrice }}</span>
      <span class="oldprice">{{ goods.oldPrice }}</span>
      <span
        class="discount"
        v-if="goods.discount"
        :style="{ backgroundColor: goods.discountBgColor }"
        >{{ goods.discount }}</span
      >
    </div>
    <div class="infoother">
      <span>{{ goods.columns[0] }}</span>
      <span>{{ goods.columns[1] }}</span>
      <span>{{ goods.services[goods.services.length - 1].name }}</span>
    </div>
    <div class="infoservice">
      <span
        class="infoserviceItem"
        v-for="index in goods.services.length - 1"
        :key="index"
      >
        <img :src="goods.services[index - 1].icon" alt="" />
        <span>{{ goods.services[index - 1].name }}</span>
      </span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    goods: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  created() {
    console.log(this.goods.discountBgColor);
  },
};
</script>
<style scoped>
.infotitle {
  font-size: 20px;
  margin-top: 10px;
  padding: 5px;
  margin-bottom: 10px;
  letter-spacing: 0.5;
}
.infoprice {
  height: 50px;
  line-height: 50px;
  position: relative;
}
.newprice {
  color: #f0b3be;
  font-size: 22px;
}
.oldprice {
  color: #c2c6c5;
  text-decoration: line-through;
  margin: 0 6px;
}
.discount {
  padding: 4px 6px;
  text-align: center;
  /* background-color: #ff6b81; */
  border-radius: 20px;
  color: white;
  line-height: 20px;
  position: absolute;
}
.infoother {
  display: flex;
  padding: 3px;
  justify-content: space-between;
  color: #6d706f;
  font-size: 16px;
}
.infoservice {
  padding: 3px;
  display: flex;
  justify-content: space-between;
}
.infoserviceItem img {
  width: 15px;
  height: 15px;
  margin-right: 5px;
}
</style>
